package com.zl.tby.vo;

import com.zl.tby.model.TbyMountainPeak;
import lombok.Data;
import org.noear.solon.validation.annotation.Length;
import org.noear.solon.validation.annotation.NotBlank;
import org.noear.solon.validation.annotation.NotNull;

import java.math.BigDecimal;

/**
 * 山峰信息bean
 * @author changpeng
 * @version 1.0
 * @since 2024/8/6 20:12
 */
@Data
public class TbyMountainPeakForm {
    /**主键id*/
    private Long id;
    /**山峰名称*/
    @NotBlank(message = "山峰名称不能为空")
    @Length(max = 20, message = "山峰名称最大长度为20")
    private String name;
    /**经度*/
    @NotBlank(message = "山峰经度不能为空")
    @Length(max = 32, message = "山峰经度最大长度为32")
    private String longitude;
    /**纬度*/
    @NotBlank(message = "山峰纬度不能为空")
    @Length(max = 32, message = "山峰纬度最大长度为32")
    private String latitude;
    /**山峰位置*/
    @NotBlank(message = "山峰位置不能为空")
    @Length(max = 20, message = "山峰位置最大长度为20")
    private String position;
    /**山峰高度*/
    @NotNull(message = "山峰高度不能为空")
    private BigDecimal height;
    /**山峰简介*/
    @Length(max = 500, message = "山峰简介最大长度为500")
    private String content;
    /**附件*/
    private String attach;

    public TbyMountainPeak createEntity() {
        TbyMountainPeak entity = new TbyMountainPeak();
        entity.setId(this.getId());
        entity.setName(this.getName());
        entity.setLongitude(this.getLongitude());
        entity.setLatitude(this.getLatitude());
        entity.setPosition(this.getPosition());
        entity.setHeight(this.getHeight());
        entity.setContent(this.getContent());
        return entity;
    }

    public void updateEntity(TbyMountainPeak entity) {
        entity.setName(this.getName());
        entity.setLongitude(this.getLongitude());
        entity.setLatitude(this.getLatitude());
        entity.setPosition(this.getPosition());
        entity.setHeight(this.getHeight());
        entity.setContent(this.getContent());
    }
}
